<?php 
class cateAction extends sfAction{
	public function execute($request){
		$cate_id = $request->getParameter('cate_id', 0);
		$tmp = ProductCates::getByIdForDisplay($cate_id);
		$data['cate_name'] = $tmp['name'];
		
		$data['pagination'] = array(
			'page'		=> $request->getParameter('page', 1),
			'limit'		=> sfConfig::get('app_limit_product'),
			'total'		=> Products::getCateProductsCount($cate_id),
			'router'	=> 'product_cate',
			'params'	=> array('cate_name' => UserStringHelper::titleToAddress($data['cate_name']), 'cate_id' => $cate_id)
		);
		
		$data['products'] = Products::getCateProducts($cate_id, $data['pagination']);
		$data['cates']	= ProductCates::getDataListFrontEnd();
		
		$this->setVar('data', $data);
	}
}